import http from '@/config/axios'

// 登录
export const login = data => {
    const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV);
    if (IS_PROD) {
        return http.post('/login/form', data);
    }
    return http.post('api/login/form', data);
}

// 获取系统所有枚举值
const baseUrl = '/v1/pc/api/dict/queryDictAllList';
// 1.04 查询所有的枚举值列表接口
export const queryDictAllList = () => http.get(`${baseUrl}`);

// 1.04 查询所有的整改适用范围列表（包含子集）
export const queryRectificationRangeList = () => http.get('/v1/pc/api/rectificationRange/queryRectificationRangeList');

// 1.03 查询所有诊改对象的值
export const queryRectificationObj = () => http.get('/v1/pc/api/rectificationObject/queryAll');

// 文件下载
export const downloadFile = data => http.get('/v1/pc/api/file/fileDownload', { params: data });

// 根据适用范围Id查询对应的诊改对象的字符串
export const getStrByRangeId = id => http.get('/v1/pc/api/rectificationObject/queryRectificationObjectStr', { params: id });

// 修改密码
export const editPwd = data => http.post('/v1/pc/api/user/modifyPassword', data);

// 初始化密码
export const initPwd = id => http.post(`/v1/pc/api/user/initPassword/${id}`);

// 联登时获取当前登录用户信息
export const getCurrentUser = () => http.post('/v1/pc/api/user/getCurrentUser');

// 获取当前用户角色
export const getUserRoles = () => http.get('')

// 退出登录
export const logout = () => http.get('/logout');
